import request from '@/utils/request'

export function getDepartments(id) {
  return request({
    url: `/department/${id}`,
    method: 'get'
  })
}

export function getTeam() {
  return request({
    url: `/department/mine`,
    method: 'get'
  })
}

export function addDepartment(data) {
  return request({
    url: '/department',
    method: 'post',
    data
  })
}

export function modifyDepartment(id, data) {
  return request({
    url: `/department/${id}`,
    method: 'put',
    data
  })
}

export function deleteDepartment(id, status) {
  return request({
    url: `/department/status/${id}?status=${status}`,
    method: 'put'
  })
}

export function checkLeader() {
  return request({
    url: '/department/leader',
    method: 'get'
  })
}
